- /* sdftansr.cpp by K.Tsuru */
- // function ID 3106 DRADIX
- /********************************
- SDouble class
- It provides the tangent tan x.
- Old version's name is "SDouble Tan(const SDouble& x)".
- *********************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SDouble TanRN(const SDouble& x){
- if(x.Sign(3106) == 0) return 0.0;
-
- int sgn, func = TAN_CALC;
- SDouble s, c, r;
- sgn = GetTriCalcMethod(x, r, &func); // |r| < pi/4
- //When tan(x) has an infinite value the domain error will occur in GetTriCalcMethod(x,r,&func);
- if(sgn == 0) return 0.0;
-
- // tan(r) = sin(r)/cos(r)
- if(r.NetRdxExp() < -1){ // |x| < 1/DRADIX^2
- s = SinSeries(r);
- c = CosRN(r);
- } else{
- RealSize C;
- uint up = s.ProperUpPrec(2u);
- if(up) C.SetEffFig(x.EffFig() + up, C.TEMP_EXTEND);
- s = SinRN(r); // |r| < pi/4 , |s| < sqrt(0.5)
- c = Sqrt(1.0-s*s);
- if(up) C.SetEffFig(0);
- }
-
- if(func == TAN_CALC) r = s*DReciprocal(c);
- else r = c*DReciprocal(s); // cot x
- if(sgn < 0) r.ChangeSign(); // r = -r;
- return r;
- }
sdftanrn.cpp : last modifiled at 2015/06/03 15:17:11(1,058 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).